// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose:  Common include file pertaining to return codes..
//   $Id$


#ifndef __COMMON_RETURN_CODES_H__
#define __COMMON_RETURN_CODES_H__

///////////////////////////////////////////////////////////////////////
// Base return code values
#define FP_RETURNCODE_BASE		0x0200
#define DIR_RETURNCODE_BASE		0x0400
#define BB_RETURNCODE_BASE		0x0600
#define CFG_RETURNCODE_BASE		0x0800

///////////////////////////////////////////////////////////////////////
// Macros
#define FP_SUCCESS_CODE(x)		MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, FP_RETURNCODE_BASE + (x))
#define FP_ERROR_CODE(x)		MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FP_RETURNCODE_BASE + (x))
#define IS_FP_CODE(x)			(((((x) & 0x0000ffff) > FP_RETURNCODE_BASE) && (((x) & 0x0000ffff) < DIR_RETURNCODE_BASE)) ? true : false)

#define DIR_SUCCESS_CODE(x)		MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, DIR_RETURNCODE_BASE + (x))
#define DIR_ERROR_CODE(x)		MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, DIR_RETURNCODE_BASE + (x))
#define IS_DIR_CODE(x)			(((((x) & 0x0000ffff) > DIR_RETURNCODE_BASE) && (((x) & 0x0000ffff) < BB_RETURNCODE_BASE)) ? true : false)

#define BB_SUCCESS_CODE(x)		MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, BB_RETURNCODE_BASE + (x))
#define BB_ERROR_CODE(x)		MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, BB_RETURNCODE_BASE + (x))
#define IS_BB_CODE(x)			(((((x) & 0x0000ffff) > BB_RETURNCODE_BASE) && (((x) & 0x0000ffff) < CFG_RETURNCODE_BASE)) ? true : false)

#define CFG_SUCCESS_CODE(x)		MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, CFG_RETURNCODE_BASE + (x))
#define CFG_ERROR_CODE(x)		MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, CFG_RETURNCODE_BASE + (x))
#define IS_CFG_CODE(x)			(((((x) & 0x0000ffff) > CFG_RETURNCODE_BASE) && (((x) & 0x0000ffff) < 0x0a00)) ? true : false)

#endif
